import request from '@/utils/request';

export const addCustomizedOrderApi = (data: any) => {
    return request({
        url: '/system/customizedProduct',
        method: 'post',
        data: data
    });
};

export const getCustomizedOrderListApi = (data: any) => {
    return request({
        url: '/system/customizedProduct/list',
        method: 'post',
        data: data
    });
};

export const editCustomizedOrderApi = (data: any)=>{
    return request({
        url: '/system/customizedProduct',
        method: 'put',
        data: data
    });
};

export const getCustomizedOrderDetailApi = (id: any)=>{
    return request({
        url: `/system/customizedProduct/${id}`,
        method: 'get'
    });
};

export const deleteCustomizedOrderDetailApi = (ids: any)=>{
    return request({
        url: `/system/customizedProduct/${ids}`,
        method: 'delete'
    })
};

/** 新增订单发货记录 */
export const orderDeliverApi = (data: any) => {
    return request({
        url: '/system/orderDeliverGoods',
        method: 'post',
        data: data
    });
};

/** 打印 */
export const printOrderApi = (data: any) => {
    return request({
        url: '/system/customizedProduct/print',
        method: 'put',
        params: data
    });
};

/** 成本分析 */
export const costAnalysisApi = (id: any) => {
    return request({
        url: '/system/customizedProduct/getCostInfo',
        method: 'get',
        params: {id: id}
    })
};

/** 销售财务审核 */
export const salerExamineApi = (data: any) => {
    return request({
        url: '/system/commonApprovalRecord',
        method: 'post',
        data: data
    })
};

/** 根据编号获取审核记录 */
export const getSalerExamineByIdApi = (id: any) => {
    return request({
        url: '/system/commonApprovalRecord/getApprovalRecord',
        method: 'get',
        params: {id: id}
    })
};

/** 财务审核 */
export const fianceExamineApi = (data: any) => {
    return request({
        url: '/system/commonApprovalRecord/financeApproval',
        method: 'put',
        data: data
    })
};

/** 撤销销售审核 */


/** 新增加急申请 */
export const applyUrgentApi = (data: any) => {
    return request({
        url: '/system/urgentApplyRecord',
        method: 'post',
        data: data
    })
};

/** 根据业务编号查询加急申请信息 */
export const getUrgentApplyByBussinessApi = (id: any) => {
    return request({
        url: '/system/urgentApplyRecord/getByBusinessId',
        method: 'get',
        params: {businessId: id}
    })
};

/** 审核加急 */
export const examineUrgentApi = (data: any) => {
    return request({
        url: '/system/urgentApplyRecord/approval',
        method: 'put',
        params: data
    });
};

/** 配料申请详情 */
export const getApplyIngredientsDetailsApi = (id: any) => {
    return request({
        url: '/system/customizedProduct/getMaterialDetail',
        method: 'get',
        params: {id: id}
    });
};

/** 保存产品配料信息 */
export const applyIngredientsApi = (data: any) => {
    return request({
        url: '/system/customizedProduct/saveIngredient',
        method: 'put',
        data: data
    });
};

/** 获取产品库存 */
export const getInventoryApi = (id: any) => {
    return request({
        url: '/system/customizedProduct/getProductInventory',
        method: 'get',
        params:{id: id}
    });
};

/** 新增订单收货地址 */
export const addAddressApi = (data: any) => {
    return request({
        url: '/system/orderDeliveryAddress',
        method: 'post',
        data: data
    })
};

/** 根据业务编号获取收货地址详情 */
export const getAddressByIdApi = (id: any) => {
    return request({
        url: '/system/orderDeliveryAddress/getAddressDetail',
        method: 'get',
        params: {id: id}
    })
};

/** 修改订单收货地址 */
export const editAddressApi = (data: any)=>{
    return request({
        url: '/system/orderDeliveryAddress',
        method: 'put',
        data: data
    });
};